<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd"
>

    <context:component-scan base-package="org.geoserver.mapml"/>
    <bean id="mapmlLayerConfig" class="org.geoserver.web.publish.LayerConfigurationPanelInfo">
        <property name="id" value="mapmlLayerConfig"/>
        <property name="componentClass" value="org.geoserver.mapml.MapMLLayerConfigurationPanel"/>
    </bean>
    <bean id="mapmlLayerGroupConfig" class="org.geoserver.web.publish.LayerGroupConfigurationPanelInfo">
        <property name="id" value="mapmlLayerGroupConfig"/>
        <property name="componentClass" value="org.geoserver.mapml.MapMLLayerGroupConfigurationPanel"/>
    </bean>
    <!-- The constructor adds the MapML gridsets through the GWC GridSetBroker  depends-on="gwcFacade"-->
    <bean id="mapMLGridsets" class="org.geoserver.mapml.gwc.gridset.MapMLGridsets" depends-on="gwcFacade"/>

    <bean id="mapMLGetFeatureOutputFormat" class="org.geoserver.mapml.MapMLGetFeatureOutputFormat">
        <constructor-arg ref="geoServer"/>
    </bean>
    <bean id="mapMLEncoder" class="org.geoserver.mapml.MapMLEncoder"/>

    <bean id="mapMLHTMLResponse" class="org.geoserver.mapml.MapMLHTMLResponse"/>
    <bean id="getFeatureMapMLCallback" class="org.geoserver.mapml.MapMLGetFeatureCallback"/>
    <bean id="wmsGetFeatureInfoMapML" class="org.geoserver.mapml.MapMLGetFeatureInfoOutputFormat">
        <constructor-arg ref="wms"/>
    </bean>
    <mvc:resources mapping="/mapml/viewer/**" location="classpath:/viewer/"/>
    <bean class="org.geoserver.mapml.MapMLMessageConverter" id="mapmlMessageConverter"/>
    <util:map id="prefixMap" value-type="java.lang.String" key-type="java.lang.String" map-class="java.util.HashMap">
        <entry key="http://www.w3.org/1999/xhtml" value=""/>
    </util:map>
    <bean class="org.springframework.oxm.jaxb.Jaxb2Marshaller" id="mapmlMarshaller">
        <property name="contextPath" value="org.geoserver.mapml.xml"/>
        <property name="marshallerProperties">
            <map>
                <entry>
                    <key>
                        <util:constant static-field="javax.xml.bind.Marshaller.JAXB_FRAGMENT"/>
                    </key>
                    <value type="java.lang.Boolean">true</value>
                </entry>
                <entry value-ref="prefixMap">
                    <key>
                        <util:constant
                                static-field="org.eclipse.persistence.jaxb.MarshallerProperties.NAMESPACE_PREFIX_MAPPER"/>
                    </key>
                </entry>
            </map>
        </property>
    </bean>
    <bean id="mapmlPreview" class="org.geoserver.web.demo.MapMLFormatLink">
        <property name="id" value="mapml"/>
        <property name="titleKey" value="MapMLPreviewLink.title"/>
        <property name="order" value="35"/>
    </bean>
    <bean id="MapMLExtension"
          class="org.geoserver.platform.ModuleStatusImpl">
        <property name="module" value="gs-mapml"/>
        <property name="name" value="MapML Extension"/>
        <property name="component" value="MapML plugin"/>
        <property name="available" value="true"/>
        <property name="enabled" value="true"/>
    </bean>
    <bean id="mapMLMapProducer" class="org.geoserver.mapml.MapMLMapOutputFormat">
        <constructor-arg index="0" ref="wms"/>
        <constructor-arg index="1" ref="geoServer"/>
    </bean>
    <bean id="mapMLHTMLProducer" class="org.geoserver.mapml.MapMLHTMLOutputFormat">
        <constructor-arg index="0" ref="wms"/>
        <constructor-arg index="1" ref="geoServer"/>
    </bean>
    <bean id="mapMLAdminPanel" class="org.geoserver.web.services.AdminPagePanelInfo">
        <property name="id" value="mapMLAdminPanel"/>
        <property name="titleKey" value="mapml"/>
        <property name="componentClass" value="org.geoserver.mapml.web.MapMLAdminPanel"/>
        <property name="serviceClass" value="org.geoserver.wms.WMSInfo"/>
    </bean>
</beans>
